package de.koller.planet2D.rcom;

import de.koller.aframe.util.thread.ICommand;
import de.koller.oceanFramework.OceanException;
import de.koller.planet2D.PNode;

public class AddPNode implements ICommand {

	private final PNode node;
	private final PNode toAdd;

	/** node.addchild( toAdd ) */
	public AddPNode( PNode node, PNode toAdd ) {
		if( toAdd.isInitialized() )
			throw new OceanException( "node is initialized!" );
		this.node = node;
		this.toAdd = toAdd;
	}
	
	@Override
	public void handle( Object... params ) {
		node.addChild( toAdd );
		node.proot.updateThis();
	}
	
}
